package com.example.demo.wuliu;

import com.example.demo.datasource.multi.dao.wuliuDao;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class addwuliuservice {
    @Autowired
    com.example.demo.datasource.multi.dao.wuliuDao wuliuDao;


    public int addwuliu(String pname,String fromprovince,String sendcity, String receiveprovince, String receivecity,
                        String fww,String fwp,String wu,String wd,String wp,String fw,String discount,String discounttype,String flag){
        String  gsname = "SELECT a.* from lctp a where a.pname = '"+pname+"'" ;
        wuliugspojo gslist = wuliuDao.qurygsnamebypname(gsname);
        String Wuliuname=gslist.getWuliuname();
        int Lctparabolic=gslist.getLctparabolic();
        int Wuliucode=gslist.getWuliucode();

        String  insertsql = "insert into wuliuyunfei(code,deliveryname,sendprovince,sendcity,receiveprovince,receivecity,fww,fwp,wu,wd,wp,fw,discount,discounttype,lctparabolic,flag) " +
                "values("+Wuliucode+",'"+Wuliuname+"','"+fromprovince+"','"+sendcity+"','"+receiveprovince+"','"+receivecity+
                "'," +fww+"," +fwp+"," +wu+"," +wd+"," +wp+"," +fw+"," +discount+"," +discounttype+"," + Lctparabolic +",'" +flag+"'"+
                ")"
                ;
        int result=wuliuDao.addwuliu(insertsql);
        System.out.println("插入条数："+result);


        return result;
    }

}
